

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;
using InfraStructureLayer;

namespace DataLayer
{
	public class datEntryCategories
	{
		public datEntryCategories()
		{
		}
		
        #region  Code Factory Generated Methods

        public void InsertEntryCategories(entEntryCategories parEntEntryCategories, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryId", parEntEntryCategories.EntryId);
            insDbParamCollection.Add("@pCategoryId", parEntEntryCategories.CategoryId);
            insDbParamCollection.AddOutput("@pEntryCategoryId", DbType.Int32);
            parDbConnector.ExecuteNonQuery("InsertEntryCategories", insDbParamCollection);
            parEntEntryCategories.EntryCategoryId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
        }
        #endregion
        public DataTable SelectEntryCategoriesByEntryId(entEntryCategories parEntEntryCategories, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryId", parEntEntryCategories.EntryId);
            return parDbConnector.ExecuteDataTable("SelectEntryCategoriesByEntryId", insDbParamCollection);
        }
        
        public void DeleteEntryCategoriesByEntryId(entEntryCategories parEntEntryCategories, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryId", parEntEntryCategories.EntryId);
            parDbConnector.ExecuteNonQuery("DeleteEntryCategoriesByEntryId", insDbParamCollection);
        }
        public DataTable SelectEntryCategoriesByCategoryId(entEntryCategories parEntEntryCategories, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pCategoryId", parEntEntryCategories.CategoryId);
            return parDbConnector.ExecuteDataTable("SelectEntryCategoriesByCategoryId", insDbParamCollection);
        }
        public DataTable SelectEntryCategoriesByEntryIdAndLanguageId(entEntryCategories parEntEntryCategories, DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pEntryId", parEntEntryCategories.EntryId);
            insDbParamCollection.Add("@pLanguageId", CurrentContext.LanguageId);
            return parDbConnector.ExecuteDataTable("SelectEntryCategoriesByEntryIdAndLanguageId", insDbParamCollection);
        }
	}
}